package com.swfee.qinben.adpt;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.swfee.qinben.R;
import com.swfee.qinben.dto.active.CommentModel;
import com.swfee.qinben.dto.active.MedicalRecordModel;

// 适配器
public class MedicalRecordAdapter extends BaseAdapter {

	private List<MedicalRecordModel> list;
	private Context context;
	private LayoutInflater inflater;

	public MedicalRecordAdapter(List<MedicalRecordModel> list, Context context) {
		this.list = list;
		this.context = context;
		this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		if (convertView == null) {
			convertView = inflater.inflate(R.layout.medical_record_include, null);
			TextView doctorName = (TextView) convertView.findViewById(R.id.doctor_name);
			TextView medicalRecord = (TextView) convertView.findViewById(R.id.medical_record);
			TextView recordTime = (TextView) convertView.findViewById(R.id.record_time);
			MedicalRecordModel model = list.get(position);
			doctorName.setText(model.getDoctorName());
			medicalRecord.setText(model.getRecord());
			recordTime.setText(model.getRecordtime());
		}

		return convertView;
	}
}